home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2 Examples.sit
/
Raven 1.2 Examples
/
Quill
/
Source
/
MacButtonEditor.cpp
< prev
next >
Wrap
Text File
|
1997-02-20
|
3KB
|
131 lines
/*
* File: MacButtonEditor.h
* Summary: A view that knows how to edit a TMacButton.
* Written by: Jesse Jones
*
* Copyright ゥ 1996 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <-> 1/06/96 JDJ Created
*/
#include "MacButtonEditor.h"
#include <ZTextBox.h>
// ===================================================================================
// class CEditMacButtonCommand
// ===================================================================================
//---------------------------------------------------------------
//
// CEditMacButtonCommand::~CEditMacButtonCommand
//
//---------------------------------------------------------------
CEditMacButtonCommand::~CEditMacButtonCommand()
{
}
//---------------------------------------------------------------
//
// CEditMacButtonCommand::CEditMacButtonCommand
//
//---------------------------------------------------------------
CEditMacButtonCommand::CEditMacButtonCommand(TMacButton* pane, const SMacButtonInfo& oldInfo, const SMacButtonInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
{
}
//---------------------------------------------------------------
//
// CEditMacButtonCommand::UpdatePane
//
//---------------------------------------------------------------
void CEditMacButtonCommand::UpdatePane(const SMacButtonInfo& info)
{
mPane->SetCommandKey(info.commandKey);
}
#pragma mark -
// ===================================================================================
// CMacButtonEditor
// ===================================================================================
static TReanimatorRegister<CMacButtonEditor> sMacButtonEditorRegistrar;
//---------------------------------------------------------------
//
// CMacButtonEditor::~CMacButtonEditor
//
//---------------------------------------------------------------
CMacButtonEditor::~CMacButtonEditor()
{
}
//---------------------------------------------------------------
//
// CMacButtonEditor::CMacButtonEditor
//
//---------------------------------------------------------------
CMacButtonEditor::CMacButtonEditor(TView* superView) : Inherited(superView)
{
}
//---------------------------------------------------------------
//
// CMacButtonEditor::Create [static]
//
//---------------------------------------------------------------
MReanimatable* CMacButtonEditor::Create(MReanimatable* parent)
{
return new CMacButtonEditor(dynamic_cast<TView*>(parent));
}
//---------------------------------------------------------------
//
// CMacButtonEditor::GetEditorInfo
//
//---------------------------------------------------------------
SMacButtonInfo CMacButtonEditor::GetEditorInfo() const
{
SMacButtonInfo info;
TTextBox* textBox = nil;
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Command Key"));
string text = textBox->GetText();
ASSERT(text.length() <= 1);
if (text.length() == 1)
info.commandKey = text[0];
else
info.commandKey = ' ';
return info;
}
//---------------------------------------------------------------
//
// CMacButtonEditor::SetEditorInfo
//
//---------------------------------------------------------------
void CMacButtonEditor::SetEditorInfo(const SMacButtonInfo& info)
{
TTextBox* textBox = nil;
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Command Key"));
textBox->SetText(string(1, info.commandKey));
}